﻿
using MediatR;
using RBAC.Common.Domains.RabbitProject;
using RBAC.Common.Dto;
using RBAC.Common.infrastructures.interfaces;
using RBAC.Enum;

namespace RBAC.api.Application.commond.culture
{
    public class HealthCareDeelHandler 
        : IRequestHandler<HealthCareDeelCommond, Rulst>
    {

        private readonly IbaseRpository<VaccineMess> _Vaccinemess;

        public HealthCareDeelHandler(IbaseRpository<VaccineMess> vaccinemess)
        {
            _Vaccinemess = vaccinemess;
        }

        public async Task<Rulst> Handle(HealthCareDeelCommond request, CancellationToken cancellationToken)
        {
            var query = new Rulst() { Code = (int)Reult.success };


            var result=_Vaccinemess.Query().Where(x=>x.VaccioneMessid==request.VaccioneMessid).ToList();

            if(result!=null)
            {
                var del = _Vaccinemess.Delete(result);
                query.Code = del;
                query.MSG = "删除成功";
            }

            return query;
        }
    }
}
